//
//  SafeManageTableViewCell.m
//  kongfangxiong
//
//  Created by 李小龙 on 2017/6/28.
//  Copyright © 2017年 lixiaolong. All rights reserved.
//

#import "SettingTableViewCell.h"

@implementation SettingTableViewCell

- (IBAction)secondSwitchAction:(id)sender {
    UISwitch *switchButton = (UISwitch *)sender;
    self.switchBlock(switchButton.isOn);
}
+ (instancetype)settingTableViewCellWith:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    NSString *identifier = @"";//对应xib中设置的identifier
    NSInteger index = 0; //xib中第几个Cell
    switch (indexPath.section) {
        case 0:
        {
            switch (indexPath.row) {
                case 1: case 2: case 3: case 4:
                {
                    identifier = @"settingIdentifierFirst";
                    index = 0;
                    break;
                }
                case 0:
                {
                    identifier = @"settingIdentifierSecond";
                    index = 1;
                    break;
                }
                default:
                    break;
            }
        } break;
        case 1:
        {
            switch (indexPath.row) {
                case 0:
                {
                    identifier = @"settingIdentifierThird";
                    index = 2;
                    break;
                }
                default:
                    break;
            }
        } break;
        default:
            break;
    }
    
    
    SettingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"SettingTableViewCell" owner:self options:nil] objectAtIndex:index];
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
